<template>
  <!-- <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <cy-gas-store-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cy-gas-store-form>
  </j-modal> -->


  <a-drawer
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    @close="close"
    destroyOnClose
    :visible="visible">
    <cy-gas-store-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></cy-gas-store-form>
    <div class="drawer-footer" style="float:right">
      <span style="margin-right:20px">
        <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
      </span>

      <span style="margin-right:20px">
        <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
      </span>
      
      
    </div>
  </a-drawer>









</template>

<script>

  import CyGasStoreForm from './CyGasStoreForm'
  export default {
    name: 'CyGasStoreModal',
    components: {
      CyGasStoreForm
    },
    data () {
      return {
        title:'新增气体',
        width:600,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>